public class TwoSum {

    /**
     *
     * @param nums
     * @param target
     * @return
     */
    public int[] twoSum(int[] nums, int target) {
        int low = 0;
        int high = nums.length;
        while (low<high){
            if (nums[low]+nums[high]==target)
                return new int[]{low,high};
            else if (nums[low]+nums[high]>target){
                high--;
            }else {
                low++;
            }
        }

        return new int[0];

    }
}
